package cn.sh.tools;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.lang.management.ManagementFactory;

/**
 * @author shihao
 * @description 启动类
 */
@SpringBootApplication//(exclude = {DataSourceAutoConfiguration.class})
@EnableScheduling
@EnableSwagger2
@EnableAspectJAutoProxy(proxyTargetClass = true)
@Slf4j
public class ShApp {

    public static void main(String[] args) {
        SpringApplication.run(ShApp.class);

        // 获取并输出 当前应用 使用的垃圾回收器
        ManagementFactory.getGarbageCollectorMXBeans()
                .forEach(garbageCollectorMxBean ->
                        System.out.println("GC is: " + garbageCollectorMxBean.getName())
                );
        // 输出 启动参数
        ManagementFactory.getRuntimeMXBean().getInputArguments()
                        .forEach(System.out::println);

        log.info("ShApp Service started");
    }

}
